
PREFIX := aarch64-linux-gnu-

CC := $(PREFIX)gcc
LD := $(PREFIX)ld
# ARMCC := armclang --target=aarch64-arm-none-eabi -march=armv8.3-a+sve
# OBJDUMP := fromelf -c
# OBJDUMP := llvm-objdump -mattr=+sve -d
OBJDUMP := $(PREFIX)objdump -d 

all: clean mem_rw

mem_rw: mem_rw1.o start.o
	$(LD) -T$@.lds $^ -o $@.elf
	$(OBJDUMP) $@.elf > $@.asm

%.ao: %.S
	$(ARMCC) -c $^ -o $@
%.o: %.S
	$(CC) -c $^ -o $@

%.o: %.c
	$(CC) -c $^ -o $@

clean:
	touch *.{ao,o,elf,asm}
	rm *.{ao,o,elf,asm}
	